package cn.power.win.win_power.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import cn.power.win.win_power.R;
import cn.power.win.win_power.view.ChartView;
import cn.power.win.win_power.view.LineView;
import me.jessyan.autosize.internal.CustomAdapt;

/**
 * Created by Jay on 2015/8/28 0028.
 * 历史
 */
public class HistoryFragment extends Fragment implements CustomAdapt {

    private LineView mLineView;
    List<String> xList = new ArrayList<>();
    List<Float> yList = new ArrayList<>();
    private ChartView mlineView;

    public HistoryFragment() { }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_history,container,false);
        initView(view);
        initData();
        return view;
    }

    private void initView(View view) {
     //  mLineView = (LineView) view.findViewById(R.id.line_View);
        mlineView = (ChartView) view.findViewById(R.id.line_View);
        mlineView.setInfo(
                new String[]{"","02","03","04","05","06","07","08","09"},   //X轴刻度
                new String[]{"","10","20","30","40","50","60","70","80","90"},   //Y轴刻度
                new String[]{0+"",15.5+"",18.4+"",24.6+"",36.2+"",44.2+"",50.4+""}, //数据
                "累计电量（Kwh）");
   /*     mlineView.setRange(
                new float[]{4.4f,7f,10f});//范围*/
    }

    private void initData() {
     /*   mLineView.setData( Arrays.asList("02-1","02-1","02-1","02-1","02-1","02-1","02-1"),
                Arrays.asList(1.0f,2.0f,3.0f,4.0f,5.0f,6.0f,7.0f));*/
      //  ChartView myView = new ChartView(getActivity());
     /*   mlineView.SetInfo(
                new String[]{"7-11","7-12","7-13","7-14","7-15","7-16","7-17"},   //X轴刻度
                new String[]{"","50","100","150","200","250"},   //Y轴刻度
                new String[]{"15","23","10","36","45","40","12"} , //数据
                "图标的标题"
        );*/

    }


    @Override
    public boolean isBaseOnWidth() {
        return true;
    }

    @Override
    public float getSizeInDp() {
        return 670;
    }
}
